Computer programmers ordinarily write software programs in human-readable high-level languages such as C or C++. Such a program is normally translated by a compiler to lower-level machine code, which is executed by a processor. High-level languages are not hardware-specific: a programmer writing a C or C++ program need not necessarily know the specific type of hardware system that the program will run on. High-level languages can represent relatively complex algebraic and boolean operations, which can be performed on various variable types and complex data structures. High-level languages include representations of operations such as multiplication and division, as well as relational and logical operations such as AND, OR, greater than, and less than or equal to, among others. Commonly used variable types include character (denoted in C as char), integer (int), including short integer (short) and long integer (long), single-precision floating point (float) and double-precision floating point (double). Data structures may include arrays, as well as more complex structures including multiple fields of various types.
Consider for example a database containing personal information for a number of persons. Such a database may store a number of personal records, each organized as prescribed by a data structure. A data structure representing a personal record may have various fields, each representing some part of the personal record, such as a name, address, and date of birth associated with that personal record. Some fields of the data structure may include character arrays, while others may include integers or floating point numbers.
The central processing unit (CPU) of a computer normally operates on hardware-specific, low-level machine code. Machine code ordinarily consists of a sequence of binary numbers (a sequence of ones and zeros), which represent low-level operations to be performed by the processor. Such operations include moving data between registers and memory, and performing additions and subtractions on the contents of specified registers. Machine code represented as sequences of binary or hexadecimal numbers is difficult to read by humans. The various low-level machine-code operations can be represented in text form, or assembly language, which is easier to read by humans. Translating between assembly language and machine language is a relatively simple process: each assembly language instruction represents a single machine instruction.
A compiler is a computer program that translates high-level source code into assembly language or machine language code. Each high-level language statement may be translated into a large number of corresponding machine code instructions. In effect, a compiler translates a relatively small number of complex, human-readable instructions into a larger number of simpler, machine-readable instructions. Generating machine code using a compiler is considerably faster and simpler than manually writing machine or assembly code. At the same time, conventional compilers may generate machine code of suboptimal computational efficiency. In particular, conventional systems may be inefficient in performing operations on internal fields of data structures.